#include "internal.h"

const struct sched_class dl_sched_class;

static void set_next_task_dl(struct rq *rq, struct task_struct *p, bool first)
{
    struct sched_dl_entity *dl_se = &p->dl;
    struct dl_rq *dl_rq = &rq->dl;

    p->se.exec_start = rq_clock_task(rq);
    if (on_dl_rq(&p->dl))
        update_stats_wait_end_dl(dl_rq, dl_se);

    /* You can't push away the running task */
    dequeue_pushable_dl_task(rq, p);

    if (!first)
        return;

    if (rq->donor->sched_class != &dl_sched_class)
        update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 0);

    deadline_queue_push_tasks(rq);

    if (hrtick_enabled_dl(rq))
        start_hrtick_dl(rq, &p->dl);
}
